#!/user/bin/env node

const cp = require('child_process'),
      arg = process.argv;
let cmd = arg[2];
let file = arg.splice(3,arg.length);
let cat;

console.log('pid',process.pid);
if(arg.length == 2){

  cat = cp.spawn('cat',['02-spawn-v1.js']);
}else{
  cat = cp.spawn(cmd,file);
}
cat.stdout.pipe(process.stdout);
cat.stderr.pipe(process.stderr);

